<template>
	<el-drawer title="试卷详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form :model="form" ref="dialogForm" label-width="100px" label-position="left">
					<div style="text-align: center;font-size: 20px;font-weight: 600;margin-bottom: 40px">{{ form.title }}</div>
					<div v-for="(qList,index) in questionsList" :key="index" style="width: 100%;">
						<span style="font-size: 16px;font-weight: 600">{{ index + 1 }}、{{ qList.title }}</span><span style="margin-left: 20px;color: red">{{ qList.grade }}</span>/分
						<div v-if="qList.examType=='2'">
							<el-input type="textarea" placeholder="简述"></el-input>
						</div>
						<div v-else-if="qList.examType=='0'">
							<el-radio-group>
								<el-radio  v-for="(item,i) in qList.questionsList" :key="i" style="width: 100%;margin-left: 40px;font-size: 14px;margin-bottom: 5px" :label="item.optValue+`、`+item.childTitle" :value="item.optValue"></el-radio>
							</el-radio-group>
						</div>
						<div v-else>
							<el-checkbox-group>
								<el-checkbox v-for="(item,i) in qList.questionsList" :key="i" style="width: 100%;margin-left: 40px;font-size: 14px;margin-bottom: 5px" :label="item.optValue+`、`+item.childTitle" :value="item.optValue"></el-checkbox>
							</el-checkbox-group>
						</div>
					</div>
					<el-form-item label="备注" style="margin-top: 20px;">{{ form.remark }}</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
export default {
	emits: ['success', 'closed'],
	components: {},
	data() {
		return {
			loading: false,
			questionsList: [],
			form: {
				recordId: '',
				title: '',
				sortId: '',
				questionsList: '',
				sortNo: '0',
				status: "0",
				remark: '',
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model) {
			this.model = model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			this.form.recordId = data.recordId
			this.form.title = data.title
			this.form.sortId = data.sortId
			this.form.questionsList = data.questionsList
			this.form.sortNo = data.sortNo
			this.form.status = data.status
			this.form.remark = data.remark
			if (data.questionsList != null) {
				this.questionsList = JSON.parse(data.questionsList);
			}
		},
	}
}
</script>

<style>
</style>
